<template>
  <div class="box">
    <van-nav-bar
      title="个人中心"
      left-text="返回"
      right-text="退出"
      left-arrow
      @click-left="onClickLeft"
      @click-right="onClickRight"
    />
    <span>个人中心</span>
    <div class="list">
      <RouterLink to="/address">
        <van-cell is-link title="地址管理" />
      </RouterLink>
      <RouterLink to="/order">
        <van-cell is-link title="订单中心" />
      </RouterLink>
    </div>
  </div>
</template>

<script setup lang="ts">
import { useCounterStore } from "@/stores/counter";
import { showToast } from "vant";
// import { useStore } from "vuex";
import { useRouter } from "vue-router";
import { onMounted } from "vue";
// let store = useStore();
let store =useCounterStore();
let router = useRouter();
onMounted(()=>{
  store.shownav=false;
})
function onClickLeft() {
  history.back();
}
function onClickRight() {
  localStorage.removeItem("token");
  store.setUserInfo("");
  store.chuserid("");
  router.push("login");
  showToast("退出登录");
}
</script>

<style lang="scss" scoped>
.box {
  background-color: #f5f5f5;
  height: 100vh;
  span {
    font-size: 14px;
    margin: 10px;
  }
}
.list {
  margin: 10px 10px;
}
</style>
